import router from './index'
import store from '@/store'

/**
 * 权限
 */
router.beforeEach((to, from, next) => {
  // to.meta.auth=true需要验证Token,token 验证失败就需要登录
  if (to.meta.auth) {
    if (!store.state.token) next('/login')
  }

  document.title = to.meta.title
  next()
})
